package at.fhooe.im440.pandora;

import at.fhooe.im440.pandora.core.Core;
import at.fhooe.im440.pandora.entities.AsteroidEmmitter;
import at.fhooe.im440.pandora.entities.EmmitterSettings;
import at.fhooe.im440.pandora.entities.Entity;
import at.fhooe.im440.pandora.entities.PacPill;
import at.fhooe.im440.pandora.entities.Pacman;
import at.fhooe.im440.pandora.enumeration.Enumerations.ClockType;
import at.fhooe.im440.pandora.graphics.GraphicsConfig;
import at.fhooe.im440.pandora.graphics.RenderLayer;
import at.fhooe.im440.pandora.hud.Clock;
import at.fhooe.im440.pandora.hud.HUD;
import at.fhooe.im440.pandora.time.Time;
import at.fhooe.im440.pandora.util.CommandLineParser;

public class Pandora {

	final static boolean FULLSCREEN = false;
	
	static Core c;

	public static void main(String[] args) {

		CommandLineParser clp = new CommandLineParser(args);
		c = new Core(new GraphicsConfig(clp.width(), clp.height(), 60, FULLSCREEN));
				
		Entity pacman = new Pacman(c, "pacman",0, 0, 80, 80);
		pacman.setRenderLayer(RenderLayer.LAYER_12);
		
		//Entity asteroid = new AsteroidEntity("aster",c);
		//asteroid.setRenderLayer(RenderLayer.LAYER_12);
		
		Entity ae = new AsteroidEmmitter("emmitter",c);
		EmmitterSettings es = new EmmitterSettings();
		es.setFrequency(0.5f);

		Entity paypill = new PacPill(c, "pacpill1", 0, 0, 10);
		paypill.setRenderLayer(RenderLayer.LAYER_1);
		ae.setRenderLayer(RenderLayer.LAYER_12);
		c.addEntity(paypill);
		c.addEntity(pacman);
		c.addEntity(ae);
		//c.addEntity(asteroid);
		
		// Time
		Time time = new Time(c);

		// HUD
		HUD gameClock = new Clock("game", c, time, 350, -280, 40, ClockType.GAMECLOCK);
		c.addHUD(gameClock);
		HUD pauseClock = new Clock("pause", c, time, 230, -280, 40, ClockType.PAUSECLOCK); 
		c.addHUD(pauseClock);

		while(c.getRunLoop() != false)
		{
			paypill.setPosition(10, 10);
			c.requestUpdate();
		}
		
		c.closeWindow();
	}
}